package com.hw.backapi.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hw.backapi.service.IOssMemoService;
import com.hw.model.entity.OssMemoPO;
import com.hw.model.mapper.OssMemoMapper;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者
 * @since 2023-03-08
 */
@Service
public class OssMemoServiceImpl extends ServiceImpl<OssMemoMapper, OssMemoPO> implements IOssMemoService {

    @Override
    public List<OssMemoPO> getOssMemoList(List<Long> patientIds) {
        if(CollectionUtil.isEmpty(patientIds)){
            return Collections.emptyList();
        }
        LambdaQueryWrapper<OssMemoPO> query = new LambdaQueryWrapper<>();
        query.in(OssMemoPO::getCid,patientIds);
        query.orderByDesc(OssMemoPO::getId);
        return this.list(query);
    }
}
